package com.example.deliveryapp;

import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;

public class OrderDetailsActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_order_details);

        // 获取传递过来的总价和备注
        double totalAmount = getIntent().getDoubleExtra("total_price", 0);
        String remarks = getIntent().getStringExtra("remarks");

        // 初始化 UI 组件
        TextView totalAmountTextView = findViewById(R.id.total_amount_text_view);
        TextView remarksTextView = findViewById(R.id.remarks_text_view);

        // 显示总价和备注
        totalAmountTextView.setText(String.format("总价: $%.2f", totalAmount));
        remarksTextView.setText(remarks != null ? "备注: " + remarks : "无备注");

        TextView exit = findViewById(R.id.exit);
        exit.setOnClickListener(v -> {
            Intent intent = new Intent(OrderDetailsActivity.this, MainPageActivity.class);
            startActivity(intent);
        });

    }
}